<template>
  <div id="app">
    <header class="head">
      <a class="back tl" href="javascript:history.back(-1)">
        <i class="el-icon-arrow-left"></i>
      </a>
      <a href="javascript:;" class="tc">
        <small class="font_18 co_f">土地档案</small>
      </a>
    </header>
    <main>
        <section class="item-title">
          搜索到：房产处数:<span>{{countNum}}</span> 土地面积：<span>{{countarea.toFixed(2)}}</span>
        </section>
        <section>
            <ul class="munebox">
              <li>
                 <router-link :to='{name: "LandArchiveslist",query:{earth:this.earth,allarea:this.allarea1.toFixed(2)}}'> 
                    <img :src="land[0].src"> 
                    <p>土地档案</p>
                 </router-link>
              </li>
              <li>
                 <router-link :to='{name: "LandIdlelist",query:{earth:this.LieEarth,allarea:this.allarea}}'> 
                   <img :src="land[1].src"> 
                    <p>闲置土地档案</p>
                   </router-link>
              </li>
            </ul>
        </section>
    </main>
  </div>
</template>

<script type="text/ecmascript-6">
 import { mapState } from 'vuex'
 import {
    EarthRecordsList
  } from '../../api/api';
  import {
    LieEarthRecordsList
  } from '../../api/api';
  
 export default {
  components: {
  },
  data() {
    return {
        //土地档案
         earth:"",
         LieEarth:"",
        //闲置面积
        area:"",
        liearea:"",

        allarea:0,
        allarea1:0,
    };
  },
  computed: {
    ...mapState({
      land: state => state.managementStore.land,
    }),
    countNum:function(){
       return Number(this.LieEarth) + Number(this.earth)
    },
    countarea:function(){
       return Number(this.allarea1) + Number(this.allarea)
    }
  },
  methods: {
      getData() {
         let options  = {
          params: {
              vc: this.PageSize,
              vp: this.CurrentPage,
              vf:this.CriteriaList
          }
        }
        //调取接口
        LieEarthRecordsList(options).then((res) => {//闲置土地档案
           this.LieEarth=res.viewEntries.length
            var i=0;
           for(i in res.viewEntries){
             this.allarea +=JSON.parse(res.viewEntries[i].values[9]);
          }
           return this.allarea;
        })
        EarthRecordsList(options).then((res) => {//土地档案
            this.earth=res.length
           var i=0;
           for(i in res){
             this.allarea1 +=JSON.parse(res[i].values[9]);
          }
           return this.allarea1;
        })
      },
     
  },
  mounted() {
    this.getData();
  }

}
</script>
<style lang="scss" scoped>

</style>
